
/**
 * Date:2022年9月3日下午12:30:03
 * Copyright (c) 2022, www.bwbroad.com All Rights Reserved.
 *
*/

package com.action;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.net.InetSocketAddress;

import com.action.Math2DTO.Builder;
import com.google.protobuf.InvalidProtocolBufferException;
import com.util.JdkProxyFactory;

/**
 * Description: TODO <br/>
 * Date:     2022年9月3日 下午12:30:03 <br/>
 * @author   wangbing	 
 */
public class RPCClientTest {

	public static void main(String[] args) {
		TestDTO testDTO = new TestDTO();
		testDTO.setX(3);
		testDTO.setY(6);
		RPCClient rpcClient = new RPCClientImp();
		JdkProxyFactory jdkProxyFactory = new JdkProxyFactory();
		RPCClient proxyClient = (RPCClient) jdkProxyFactory.newProxyInstance(rpcClient);
		Object result = proxyClient.math(testDTO, new InetSocketAddress("localhost", 8088));
		System.out.println(result);
	        
	    }
	
	
//	public static void main(String[] args) {
//		//protoc序列化
//		Math2DTO dtoBuild = Math2DTO.newBuilder().setX(2).setY(3).build();
//		byte[] bytes = dtoBuild.toByteArray();
//		System.out.println(bytes);
//
//		Math2DTO parseFrom ;
//		try {
//			parseFrom = Math2DTO.parseFrom(bytes);
//			System.out.println(parseFrom);
//		} catch (InvalidProtocolBufferException e) {
//			e.printStackTrace();
//		} 
//		
//	}

}

